package com.example.human_resource_management.mapper;

import com.example.human_resource_management.entry.dto.PositionDepartmentDto;
import com.example.human_resource_management.entry.po.Position;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【position(职位表)】的数据库操作Mapper
* @createDate 2025-06-09 08:49:10
* @Entity com.example.human_resource_management.entry.po.Position
*/
public interface PositionMapper extends BaseMapper<Position> {
    @Select("SELECT p.pos_id, p.pos_name, p.description, p.dept_id, d.dept_name " +
            "FROM position p " +
            "JOIN department d ON p.dept_id = d.dept_id")
    List<PositionDepartmentDto> selectPositionDepartmentList();

    @Select("SELECT p.pos_id, p.pos_name, p.description, p.dept_id, d.dept_name " +
            "FROM position p " +
            "JOIN department d ON p.dept_id = d.dept_id " +
            "WHERE p.pos_id = #{posId}")
    PositionDepartmentDto selectPositionDepartmentById(Long posId);
}




